package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.UsersDao;
import daoImpl.UserDaoImpl;
import entlty.Users;

/**
 * Servlet implementation class Zhuce
 */
@WebServlet("/Zhuce")
public class Zhuce extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String s="";
		String iphone=req.getParameter("iphone");
		if(iphone!=null&&!iphone.equals("")){
			s=iphone;
		}
		Users u=new Users(0,s,s);
		UsersDao udao=new UserDaoImpl();
		int user=udao.tianjia(u);
		if(user>0){

		    resp.sendRedirect(req.getContextPath()+"/Erjicaidan");
		}
		
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	this.doGet(req, resp);
	}
}
